/**
 * Copyright (C) 2010 KingCore Science & Technology CO,.LTD. All rights reserved.
 * XNS PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/**
 * Copyright (C) 2002-2010 WUZEWEN. All rights reserved.
 * WUZEWEN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 * This software is the confidential and proprietary information of
 * WuZeven, Personal. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with WuZeven.
 */

package com.kingcore.director.core.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>java class file describe</p>
 * @author Zeven on 2010-8-17
 * @version	1.0
 * @see		Object#equals(java.lang.Object)
 * @since	JDK5
 */
 
public class Formatter {

	private static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public static String format(Date date, String pattern){
		sdf.applyPattern(pattern);
		return sdf.format(date);		
	}

	public static String formatObject(Object obj, String pattern){
		return obj.toString();		
	}

	public static String formatDate(String dateStr ){
		if(dateStr!=null && dateStr.length()>19){
			dateStr = dateStr.substring(0, 19); //统一：yyyy-mm-dd hh:mm:ss
		}
		return dateStr;
	}
	/**
	 * <p>java method describe</p>
	 * @author Zeven on 2010-8-17
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
